package com.j283_5.wisdom_park.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.j283_5.wisdom_park.vo.maintenance_management.MaintenanceDeliveryVo;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author shkstart
 * @create 2022-05-09-2:51
 */
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class MaintenanceDelivery implements Serializable {
    /**
     * 运维记录id
     */
    @TableId(value = "mrec_id", type = IdType.AUTO)
    private Integer mrecId;
    /**
     * 设备名称
     */
    private String ddetName;

    /**
     * 设备编号
     */
    private String ddetNumber;
    /**
     * 0:故障检修,1:日常巡检
     */
    private Integer mrecMaintenancetype;
    /**
     * 巡检时间
     */
    private Timestamp mrecDate;
    /**
     * 0:未完成,1:巡检中,2:已完成
     */
    private Integer mrecMaintenancestate;
    /**
     * 跟进人
     */
    private String adminName;
    /**
     * 跟进人电话
     */
    private String adminPhone;
    /**
     * 处理结果
     */
    private String mrecResult;

    /**
     * 预警现场的照片
     */
    private String mrecLivephoto;
    /**
     * 安装位置
     */
    private String dinfLocation;
    /**
     * 预警内容
     */
    private String wrecContent;

    /**
     * 持续时间
     */
    private Timestamp wrecDuration;
    /**
     * 设备型号
     */
    private String ddetType;

    /**
     * 设备厂家
     */
    private String ddetFactory;
    /**
     * 出场时间
     */
    private Timestamp ddetFactorydate;
    /**
     * 产品版本
     */
    private String ddetVersion;

    public MaintenanceDelivery(MaintenanceDeliveryVo maintenanceDeliveryVo){
        this.ddetName = maintenanceDeliveryVo.getDdetName();
        this.ddetNumber = maintenanceDeliveryVo.getDdetNumber();
        this.dinfLocation = maintenanceDeliveryVo.getDinfLocation();
        this.mrecId = maintenanceDeliveryVo.getMrecId();
        this.wrecContent = maintenanceDeliveryVo.getWrecContent();
        if (maintenanceDeliveryVo.getMrecDate() != null) {
            this.mrecDate = maintenanceDeliveryVo.getMrecDate();
        }
        if (maintenanceDeliveryVo.getMrecMaintenancetype() != null){
            setMrecMaintenancetype(maintenanceDeliveryVo.getMrecMaintenancetype());
        }
        if (maintenanceDeliveryVo.getMrecMaintenancestate() != null){
            setMrecMaintenancestate(maintenanceDeliveryVo.getMrecMaintenancestate());
        }
        if (maintenanceDeliveryVo.getAdminName() != null) {
            this.adminName = maintenanceDeliveryVo.getAdminName();
        }
        if (maintenanceDeliveryVo.getAdminPhone() != null) {
            this.adminPhone = maintenanceDeliveryVo.getAdminPhone();
        }
        if (maintenanceDeliveryVo.getMrecResult() != null) {
            this.mrecResult = maintenanceDeliveryVo.getMrecResult();
        }
        if (maintenanceDeliveryVo.getMrecLivephoto() != null) {
            this.mrecLivephoto = maintenanceDeliveryVo.getMrecLivephoto();
        }
        this.wrecDuration = maintenanceDeliveryVo.getWrecDuration();
        this.ddetType = maintenanceDeliveryVo.getDdetType();
        this.ddetFactory = maintenanceDeliveryVo.getDdetFactory();
        this.ddetFactorydate = maintenanceDeliveryVo.getDdetFactorydate();
        this.ddetVersion = maintenanceDeliveryVo.getDdetVersion();
    }
    public void setMrecMaintenancetype(String mrecMaintenancetype){
        switch (mrecMaintenancetype){
            case "故障检修":
                this.mrecMaintenancetype = 0;
                return;
            case "日常巡检":
                this.mrecMaintenancetype = 1;
                return;
            default:
                this.mrecMaintenancetype = null;
        }
    }

    public void setMrecMaintenancestate(String mrecMaintenancestate){
        switch (mrecMaintenancestate){
            case "未完成":
                this.mrecMaintenancestate = 0;
                return;
            case "巡检中":
                this.mrecMaintenancestate = 1;
                return;
            case "已完成":
                this.mrecMaintenancestate = 2;
                return;
            default:
                this.mrecMaintenancestate = null;
        }
    }

    public Integer getMrecId() {
        return mrecId;
    }

    public void setMrecId(Integer mrecId) {
        this.mrecId = mrecId;
    }

    public String getDdetName() {
        return ddetName;
    }

    public void setDdetName(String ddetName) {
        this.ddetName = ddetName;
    }

    public String getDdetNumber() {
        return ddetNumber;
    }

    public void setDdetNumber(String ddetNumber) {
        this.ddetNumber = ddetNumber;
    }

    public Integer getMrecMaintenancetype() {
        return mrecMaintenancetype;
    }

    public void setMrecMaintenancetype(Integer mrecMaintenancetype) {
        this.mrecMaintenancetype = mrecMaintenancetype;
    }

    public Timestamp getMrecDate() {
        return mrecDate;
    }

    public void setMrecDate(Timestamp mrecDate) {
        this.mrecDate = mrecDate;
    }

    public Integer getMrecMaintenancestate() {
        return mrecMaintenancestate;
    }

    public void setMrecMaintenancestate(Integer mrecMaintenancestate) {
        this.mrecMaintenancestate = mrecMaintenancestate;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getAdminPhone() {
        return adminPhone;
    }

    public void setAdminPhone(String adminPhone) {
        this.adminPhone = adminPhone;
    }

    public String getMrecResult() {
        return mrecResult;
    }

    public void setMrecResult(String mrecResult) {
        this.mrecResult = mrecResult;
    }

    public String getMrecLivephoto() {
        return mrecLivephoto;
    }

    public void setMrecLivephoto(String mrecLivephoto) {
        this.mrecLivephoto = mrecLivephoto;
    }

    public String getDinfLocation() {
        return dinfLocation;
    }

    public void setDinfLocation(String dinfLocation) {
        this.dinfLocation = dinfLocation;
    }

    public String getWrecContent() {
        return wrecContent;
    }

    public void setWrecContent(String wrecContent) {
        this.wrecContent = wrecContent;
    }

    public Timestamp getWrecDuration() {
        return wrecDuration;
    }

    public void setWrecDuration(Timestamp wrecDuration) {
        this.wrecDuration = wrecDuration;
    }

    public String getDdetType() {
        return ddetType;
    }

    public void setDdetType(String ddetType) {
        this.ddetType = ddetType;
    }

    public String getDdetFactory() {
        return ddetFactory;
    }

    public void setDdetFactory(String ddetFactory) {
        this.ddetFactory = ddetFactory;
    }

    public Timestamp getDdetFactorydate() {
        return ddetFactorydate;
    }

    public void setDdetFactorydate(Timestamp ddetFactorydate) {
        this.ddetFactorydate = ddetFactorydate;
    }

    public String getDdetVersion() {
        return ddetVersion;
    }

    public void setDdetVersion(String ddetVersion) {
        this.ddetVersion = ddetVersion;
    }
}
